
#include <iostream>
#include <vector>

#include "Package.h"
#include "TwoDayPackage.h"
#include "OvernightPackage.h"


using std::cout;
using std::endl;


int main()
{
    Package p1( 2.0, 3.0,
            "Rafael Savelli", "Est. Bandeirantes", "Rio", "RJ", "24780-085",
            "Leticia Savelli", "Conroy rd", "Orlando", "FL", "32839-6404");

    TwoDayPackage p2( 1.5, 5.0, 10.0,
            "Rafael Savelli", "Est. Bandeirantes", "Rio", "RJ", "24780-085",
            "Marcela Savelli", "R. Recreio", "Rio", "RJ", "73912-404");

    OvernightPackage p3( 10, 5.0, 10.0,
            "Rafael Savelli", "Est. Bandeirantes", "Rio", "RJ", "24780-085",
            "Heloisa Savelli", "Est. Francisco", "Niteroi", "RJ", "73912-404");

    OvernightPackage p4( 10, 3.0, 20.0,
            "Leticia Savelli", "Conroy rd", "Orlando", "RJ", "24780-085",
            "Heloisa Savelli", "Est. Francisco", "Niteroi", "RJ", "73912-404");

    // Cria vetor de 4 posicoes
    std::vector<Package *> encomenda(4);

    encomenda[0] = &p1;
    encomenda[1] = &p2;
    encomenda[2] = &p3;
    encomenda[3] = &p4;

    double totalCosts = 0;
    for( int i = 0; i < 4; i++ )
    {
        totalCosts += encomenda[i]->calculateCost();
        cout << "From: " << encomenda[i]->getFromAddress() << endl;
        cout << "To  : " << encomenda[i]->getToAddress() << endl;
        encomenda[i]->printCost();
    }

    cout << "Total costs: R$ " << totalCosts << endl << endl;

    return 0;
}

